﻿using System.Web;

namespace Jayden.Dll.Web.Scripts
{
	public class JsHelper
	{
		private JsHelper() { }

		public const string MimeType = "text/javascript";

		public const string True = "true";
		public const string False = "false";
		public const string Null = "null";
		public const string Undefined = "undefined";

		public static string ToJs(bool value) { return value ? True : False; }
		public static string ToJs(string text)
		{
			if (text == null)
				return Null;
			return HttpUtility.JavaScriptStringEncode(text, true);
		}
	}
}
